/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parih_threads;

/**
 *
 * @author Drak_kin
 */
public class Parih_threads {

    /**
     * @param args the command line arguments
     */
    public static int time=8*60;
    public static Semaphore wait_place=new Semaphore(20),
                sofa=new Semaphore(5),
                chair=new Semaphore(3);
    public static void main(String[] args) {
        final int count_humans = 20;
        Work what_do= new Work();
        Thread humans[]=new Thread[count_humans];
        for (int i=0;i<count_humans;++i)
            humans[i] = new Thread(what_do);
        for (int i=0;i<count_humans;++i){
            humans[i].start();
        }
        try{
            Thread.sleep(100);
            }catch(Exception x){
                System.out.println(x);
        }
        
        System.out.println("Начало нового дня");
        System.out.println("Время 8:00");
        for (;time<=20*60;time++){
            try{
                Thread.sleep(10);
            }catch(Exception x){}
        }
    }
}
